From: Giovanni Campagna Date: Mon, 27 Aug 2012 12:42:22 +0000 (+0200) Subject: Revert showing notifications in the locked screen X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~5870 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b7ae74edb92fea5e16d197bdff16fcc98509d228;p=gnome-shell.git Revert showing notifications in the locked screen As PAM messages are now shown below the password entry, there is no need for this complexity, and we can just hide all notifications. Also, this avoids the ambiguity between notification.showWhenLocked and source.showInLockScreen, which have very different effects. https://bugzilla.gnome.org/show_bug.cgi?id=683369 --- diff --git a/js/ui/main.js b/js/ui/main.js index 0fbd7310c..40b87d3c0 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -433,7 +433,6 @@ function notify(msg, details) { messageTray.add(source); let notification = new MessageTray.Notification(source, msg, details); notification.setTransient(true); - notification.setShowWhenLocked(true); source.notify(notification); } diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index f5fdeb447..c563b8fc5 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -319,7 +319,6 @@ const Notification = new Lang.Class({ this.isTransient = false; this.expanded = false; this.focused = false; - this.showWhenLocked = false; this.acknowledged = false; this._destroyed = false; this._useActionIcons = false; @@ -712,14 +711,6 @@ const Notification = new Lang.Class({ this.isTransient = isTransient; }, - setShowWhenLocked: function(show) { - if (show && !this.isTransient) { - throw new Error('ShowWhenLocked can only be set on a transient notification'); - } - - this.showWhenLocked = show; - }, - setUseActionIcons: function(useIcons) { this._useActionIcons = useIcons; }, @@ -1904,14 +1895,10 @@ const MessageTray = new Lang.Class({ // at the present time. _updateState: function() { // Notifications - let notificationQueue = this._notificationQueue.filter(Lang.bind(this, function(notification) { - return notification.showWhenLocked || Main.sessionMode.hasNotifications; - })); + let notificationQueue = this._notificationQueue; let notificationUrgent = notificationQueue.length > 0 && notificationQueue[0].urgency == Urgency.CRITICAL; - // notificationsLimited is false when the screen is locked, because they go through - // different filtering, and we want to show non urgent messages at times - let notificationsLimited = (this._busy || this._inFullscreen) && Main.sessionMode.hasNotifications; - let notificationsPending = notificationQueue.length > 0 && (!notificationsLimited || notificationUrgent); + let notificationsLimited = this._busy || this._inFullscreen; + let notificationsPending = notificationQueue.length > 0 && (!notificationsLimited || notificationUrgent) && Main.sessionMode.hasNotifications; let nextNotification = notificationQueue.length > 0 ? notificationQueue[0] : null; let notificationPinned = this._pointerInTray && !this._pointerInSummary && !this._notificationRemoved; let notificationExpanded = this._notification && this._notification.expanded; @@ -1921,15 +1908,13 @@ const MessageTray = new Lang.Class({ !this._pointerInTray && !this._locked && !(this._pointerInKeyboard && notificationExpanded); - let notificationLockedOut = !Main.sessionMode.hasNotifications && (this._notification && !this._notification.showWhenLocked); - // TODO: how to deal with locked out notiifcations if want to keep showing notifications?! + let notificationLockedOut = !Main.sessionMode.hasNotifications && this._notification; let notificationMustClose = this._notificationRemoved || notificationLockedOut || (notificationExpired && this._userActiveWhileNotificationShown) || this._notificationClosed; let canShowNotification = notificationsPending && this._summaryState == State.HIDDEN; if (this._notificationState == State.HIDDEN) { if (canShowNotification) { - this._showNotification(nextNotification); - this._notificationQueue.splice(this._notificationQueue.indexOf(nextNotification), 1); + this._showNotification(); } } else if (this._notificationState == State.SHOWN) { if (notificationMustClose) @@ -2123,8 +2108,8 @@ const MessageTray = new Lang.Class({ this._updateState(); }, - _showNotification: function(notification) { - this._notification = notification; + _showNotification: function() { + this._notification = this._notificationQueue.shift(); this._userActiveWhileNotificationShown = this.idleMonitor.get_idletime() <= IDLE_TIME; this._idleMonitorWatchId = this.idleMonitor.add_watch(IDLE_TIME, Lang.bind(this, this._onIdleMonitorWatch)); diff --git a/js/ui/overview.js b/js/ui/overview.js index eab79ff03..ddf278097 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -71,7 +71,6 @@ const ShellInfo = new Lang.Class({ if (this._source.notifications.length == 0) { notification = new MessageTray.Notification(this._source, text, null); notification.setTransient(true); - notification.setShowWhenLocked(true); } else { notification = this._source.notifications[0]; notification.update(text, null, { clear: true });